home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 7
/
Amiga Format AFCD07 (Dec 1996, Issue 91).iso
/
serious
/
shareware
/
comms
/
internet
/
html-related
/
aha!
/
arexx
/
aha!.ttx
next >
Wrap
Text File
|
1996-09-14
|
7KB
|
239 lines
/* Arexx macro to put HTML tag, that is passed from the command line as argument, around
currently selected block or current line (if no block is selected)
Written on 08/17/96 by Oleg Moskalensky
Last Modified on 09/15/96 by Oleg Moskalensky
Copyright © 1996 - Productive Computer Systems
ALL RIGHTS RESERVED
*/
/* trace ?R */
OPTIONS RESULTS
ARG Tag
address "TURBOTEXT0"
StartTag = "<" || Tag || ">"
EndTag = "</" || Tag || ">"
if Tag = "BR" then
do
insert "<BR>"
return
end
if Tag = "HR" then
do
EndTag = ""
'RequestStr PROMPT "Enter Width" "100%"'
Width = RESULT
if RC = 0 & Width ~= "100%" then StartTag = "<HR WIDTH=" || Width || ">"
end
if Tag = "P" then
do
'RequestChoice "Paragraph" "Select paragraph alignment" "Left|Center|Right|Cancel"'
Alignment = RESULT
select
when Alignment = 1 then StartTag = "<P ALIGN=LEFT>"
when Alignment = 2 then StartTag = "<P ALIGN=CENTER>"
when Alignment = 3 then StartTag = "<P ALIGN=RIGHT>"
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
end
if Tag = "IMG" then
do
'RequestFile PROMPT "Please select an IMAGE file"'
if RC = 0 then
do
Imagename = RESULT
text '<IMG SRC="' || Imagename || '"'
'RequestChoice "Image Alignment" "Select ALIGNMENT option" "TOP|MIDDLE|BOTTOM|None"'
Alignment = RESULT
select
when Alignment = 1 then 'text " ALIGN=TOP"'
when Alignment = 2 then 'text " ALIGN=MIDDLE"'
when Alignment = 3 then 'text " ALIGN=BOTTOM"'
otherwise NOP
end
text '>'
'ActivateWindow'
RETURN
end
end
if Tag = "MAIL" then
do
'RequestStr PROMPT "Enter a valid e-mail address" "pcs@accessone.com"'
email = RESULT
if RC = 0 then
do
StartTag = '<A HREF="mailto:' || email || '">'
EndTag = '</A>'
end
else
do
'ActivateWindow'
RETURN
end
end
if Tag = "FONTSIZE" then
do
'RequestChoice "Font Size" "Select FONT adjustment amount" "-3|-2|-1|+1|+2|+3|Cancel"'
FontVariation = RESULT
select
when FontVariation = 1 then StartTag = "<FONT SIZE=-3>"
when FontVariation = 2 then StartTag = "<FONT SIZE=-2>"
when FontVariation = 3 then StartTag = "<FONT SIZE=-1>"
when FontVariation = 4 then StartTag = "<FONT SIZE=+1>"
when FontVariation = 5 then StartTag = "<FONT SIZE=+2>"
when FontVariation = 6 then StartTag = "<FONT SIZE=+3>"
otherwise
do
'ActivateWindow'
RETURN
end
end
EndTag = "</FONT>"
end
if Tag = "FONTCOLOR" then
do
'RequestChoice "Font Color" "Select predefined or your own color" "Black|White|Red|Green|Blue|CHOOSE|Cancel"'
FontColor = RESULT
select
when FontColor = 1 then StartTag = '<FONT COLOR="#000000">'
when FontColor = 2 then StartTag = '<FONT COLOR="#FFFFFF">'
when FontColor = 3 then StartTag = '<FONT COLOR="#FF0000">'
when FontColor = 4 then StartTag = '<FONT COLOR="#00FF00">'
when FontColor = 5 then StartTag = '<FONT COLOR="#0000FF">'
when FontColor = 6 then
do
'RequestStr PROMPT "Enter color as a 6-digit RGB number (default: yellow)" "FFFF00"'
Color = RESULT
if RC ~= 0 then
do
'ActivateWindow'
'MarkBlk'
RETURN
end
else StartTag = '<FONT COLOR="#' || Color || '">'
end
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
EndTag = "</FONT>"
end
if Tag = "UL" then
do
'RequestChoice "Non-numbered List" "Select character style" "Bullet|Square|Circle|Cancel"'
Style = RESULT
select
when Style = 1 then ListType = ""
when Style = 2 then ListType = "TYPE=SQUARE"
when Style = 3 then ListType = "TYPE=CIRCLE"
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
end
if Tag = "OL" then
do
'RequestChoice "Numbered List" "Select numbering style" "1|I|A|a|Cancel"'
Style = RESULT
select
when Style = 1 then ListType = "TYPE=1"
when Style = 2 then ListType = "TYPE=I"
when Style = 3 then ListType = "TYPE=A"
when Style = 4 then ListType = "TYPE=a"
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
end
do
getblkinfo
parse var RESULT SelectedBlock dummy BeginRow BeginCol
if SelectedBlock = "ON" then
do
getcursorpos
parse var RESULT EndRow EndCol dummy
if (Tag = "UL" | Tag = "OL") then
do
move BeginRow 1
insert "<" || Tag || " " || ListType || ">"
'InsertLine'
BeginRow = BeginRow + 1
EndRow = EndRow + 1
call InsertLI
move EndRow 1
if (EndCol = 1) then
do
text "</" || Tag || ">"
insertline
end
else
do
moveeol
insertline
text "</" || Tag || ">"
end
'MarkBlk'
'ActivateWindow'
RETURN
end
move BeginRow BeginCol
insert StartTag
if BeginRow = EndRow then
move EndRow (EndCol + length(StartTag))
else
move EndRow EndCol
insert EndTag
'MarkBlk'
'ActivateWindow'
end
else
do
movesol
text StartTag
moveeol
text EndTag
'ActivateWindow'
end
end
exit 0
InsertLI:
do Row = BeginRow to (EndRow - ((EndCol=1) * 1))
move Row 1
text "<LI>"
end
RETURN